<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>缩放 (Scaling)</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="GDK-PixBuf 库参考手册">
<link rel="up" href="rn01.html" title="API 参考">
<link rel="prev" href="gdk-pixbuf-inline.html" title="内联数据 (Inline data)">
<link rel="next" href="gdk-pixbuf-gdk-pixbuf-rendering.html" title="渲染">
<meta name="generator" content="GTK-Doc V1.17 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="gdk-pixbuf-inline.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="rn01.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GDK-PixBuf 库参考手册</th>
<td><a accesskey="n" href="gdk-pixbuf-gdk-pixbuf-rendering.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#gdk-pixbuf-scaling.synopsis" class="shortcut">Top</a>
                   | 
                  <a href="#gdk-pixbuf-scaling.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry">
<a name="gdk-pixbuf-scaling"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="gdk-pixbuf-scaling.top_of_page"></a>缩放 (Scaling)</span></h2>
<p>缩放 (Scaling)</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="gdk-pixbuf-scaling.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
#include &lt;gdk-pixbuf/gdk-pixbuf.h&gt;

enum                <a class="link" href="gdk-pixbuf-scaling.html#GdkInterpType" title="enum GdkInterpType">GdkInterpType</a>;
<a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="returnvalue">GdkPixbuf</span></a> *         <a class="link" href="gdk-pixbuf-scaling.html#gdk-pixbuf-scale-simple" title="gdk_pixbuf_scale_simple ()">gdk_pixbuf_scale_simple</a>             (<em class="parameter"><code>const <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *src</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> dest_width</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> dest_height</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-pixbuf-scaling.html#GdkInterpType" title="enum GdkInterpType"><span class="type">GdkInterpType</span></a> interp_type</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="gdk-pixbuf-scaling.html#gdk-pixbuf-scale" title="gdk_pixbuf_scale ()">gdk_pixbuf_scale</a>                    (<em class="parameter"><code>const <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *src</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *dest</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> dest_x</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> dest_y</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> dest_width</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> dest_height</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> offset_x</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> offset_y</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> scale_x</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> scale_y</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-pixbuf-scaling.html#GdkInterpType" title="enum GdkInterpType"><span class="type">GdkInterpType</span></a> interp_type</code></em>);
<a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="returnvalue">GdkPixbuf</span></a> *         <a class="link" href="gdk-pixbuf-scaling.html#gdk-pixbuf-composite-color-simple" title="gdk_pixbuf_composite_color_simple ()">gdk_pixbuf_composite_color_simple</a>   (<em class="parameter"><code>const <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *src</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> dest_width</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> dest_height</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-pixbuf-scaling.html#GdkInterpType" title="enum GdkInterpType"><span class="type">GdkInterpType</span></a> interp_type</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> overall_alpha</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> check_size</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#guint32"><span class="type">guint32</span></a> color1</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#guint32"><span class="type">guint32</span></a> color2</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="gdk-pixbuf-scaling.html#gdk-pixbuf-composite" title="gdk_pixbuf_composite ()">gdk_pixbuf_composite</a>                (<em class="parameter"><code>const <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *src</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *dest</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> dest_x</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> dest_y</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> dest_width</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> dest_height</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> offset_x</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> offset_y</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> scale_x</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> scale_y</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-pixbuf-scaling.html#GdkInterpType" title="enum GdkInterpType"><span class="type">GdkInterpType</span></a> interp_type</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> overall_alpha</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="gdk-pixbuf-scaling.html#gdk-pixbuf-composite-color" title="gdk_pixbuf_composite_color ()">gdk_pixbuf_composite_color</a>          (<em class="parameter"><code>const <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *src</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *dest</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> dest_x</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> dest_y</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> dest_width</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> dest_height</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> offset_x</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> offset_y</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> scale_x</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> scale_y</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-pixbuf-scaling.html#GdkInterpType" title="enum GdkInterpType"><span class="type">GdkInterpType</span></a> interp_type</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> overall_alpha</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> check_x</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> check_y</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> check_size</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#guint32"><span class="type">guint32</span></a> color1</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#guint32"><span class="type">guint32</span></a> color2</code></em>);
enum                <a class="link" href="gdk-pixbuf-scaling.html#GdkPixbufRotation" title="enum GdkPixbufRotation">GdkPixbufRotation</a>;
<a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="returnvalue">GdkPixbuf</span></a> *         <a class="link" href="gdk-pixbuf-scaling.html#gdk-pixbuf-rotate-simple" title="gdk_pixbuf_rotate_simple ()">gdk_pixbuf_rotate_simple</a>            (<em class="parameter"><code>const <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *src</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-pixbuf-scaling.html#GdkPixbufRotation" title="enum GdkPixbufRotation"><span class="type">GdkPixbufRotation</span></a> angle</code></em>);
<a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="returnvalue">GdkPixbuf</span></a> *         <a class="link" href="gdk-pixbuf-scaling.html#gdk-pixbuf-flip" title="gdk_pixbuf_flip ()">gdk_pixbuf_flip</a>                     (<em class="parameter"><code>const <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *src</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> horizontal</code></em>);
</pre>
</div>
<div class="refsect1">
<a name="gdk-pixbuf-scaling.description"></a><h2>Description</h2>
<p>
</p>
</div>
<div class="refsect1">
<a name="gdk-pixbuf-scaling.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="GdkInterpType"></a><h3>enum GdkInterpType</h3>
<pre class="programlisting">typedef enum {
	GDK_INTERP_NEAREST,
	GDK_INTERP_TILES,
	GDK_INTERP_BILINEAR,
	GDK_INTERP_HYPER
} GdkInterpType;
</pre>
<p>
</p>
</div>
<hr>
<div class="refsect2">
<a name="gdk-pixbuf-scale-simple"></a><h3>gdk_pixbuf_scale_simple ()</h3>
<pre class="programlisting"><a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="returnvalue">GdkPixbuf</span></a> *         gdk_pixbuf_scale_simple             (<em class="parameter"><code>const <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *src</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> dest_width</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> dest_height</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-pixbuf-scaling.html#GdkInterpType" title="enum GdkInterpType"><span class="type">GdkInterpType</span></a> interp_type</code></em>);</pre>
<p>
创建一个包含 <em class="parameter"><code>src</code></em> 缩放到 <em class="parameter"><code>dest_width</code></em> 和 <em class="parameter"><code>dest_height</code></em> 的新的 <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>。保持 
<em class="parameter"><code>src</code></em> 不受影响。如果想速度最大化可以给 <em class="parameter"><code>interp_type</code></em> 传递 <a href="gdk-pixbuf-Scaling.html#GDK-INTERP-NEAREST:CAPS"><span class="type">GDK_INTERP_NEAREST</span></a>
(但当 <a href="gdk-pixbuf-Scaling.html#GDK-INTERP-NEAREST:CAPS"><span class="type">GDK_INTERP_NEAREST</span></a> 缩小时图像一般会变的相当难看)。 <em class="parameter"><code>interp_type</code></em> 默认值
为 <a href="gdk-pixbuf-Scaling.html#GDK-INTERP-BILINEAR:CAPS"><span class="type">GDK_INTERP_BILINEAR</span></a>，该值提供了一个合理的质量和速度。
</p>
<p>
通过创建一个指向 $src 的 sub-pixbuf 可以缩放 <em class="parameter"><code>src</code></em> 的一部分；参见 
<a class="link" href="gdk-pixbuf-creating.html#gdk-pixbuf-new-subpixbuf" title="gdk_pixbuf_new_subpixbuf ()"><code class="function">gdk_pixbuf_new_subpixbuf()</code></a>。
</p>
<p>
更复杂的缩放/合成请参见 <a class="link" href="gdk-pixbuf-scaling.html#gdk-pixbuf-scale" title="gdk_pixbuf_scale ()"><code class="function">gdk_pixbuf_scale()</code></a> 和 <a class="link" href="gdk-pixbuf-scaling.html#gdk-pixbuf-composite" title="gdk_pixbuf_composite ()"><code class="function">gdk_pixbuf_composite()</code></a>。
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>src</code></em> :</span></p></td>
<td>a <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dest_width</code></em> :</span></p></td>
<td>目标图像的宽度</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dest_height</code></em> :</span></p></td>
<td>目标图像的高度</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>interp_type</code></em> :</span></p></td>
<td>变形时使用的插值类型。</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the new <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if not enough memory could be
allocated for it. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-pixbuf-scale"></a><h3>gdk_pixbuf_scale ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gdk_pixbuf_scale                    (<em class="parameter"><code>const <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *src</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *dest</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> dest_x</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> dest_y</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> dest_width</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> dest_height</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> offset_x</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> offset_y</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> scale_x</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> scale_y</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-pixbuf-scaling.html#GdkInterpType" title="enum GdkInterpType"><span class="type">GdkInterpType</span></a> interp_type</code></em>);</pre>
<p>
通过 <em class="parameter"><code>scale_x</code></em> 和 $scale_y 指定的缩放以及 <em class="parameter"><code>offset_x</code></em> 和 <em class="parameter"><code>offset_y</code></em> 指定的偏移量
创建一个原始图像 <em class="parameter"><code>src</code></em> 的变形图像，并将其一个矩形区域(<em class="parameter"><code>dest_x</code></em>, <em class="parameter"><code>dest_y</code></em>, 
<em class="parameter"><code>dest_width</code></em>, <em class="parameter"><code>dest_height</code></em>)渲染到目标图像以取代先前的内容。
</p>
<p>
先尝试使用 <a class="link" href="gdk-pixbuf-scaling.html#gdk-pixbuf-scale-simple" title="gdk_pixbuf_scale_simple ()"><code class="function">gdk_pixbuf_scale_simple()</code></a> ，如果 <a class="link" href="gdk-pixbuf-scaling.html#gdk-pixbuf-scale-simple" title="gdk_pixbuf_scale_simple ()"><code class="function">gdk_pixbuf_scale_simple()</code></a> 不够强
大时你可以退回来使用这是一个工业强度(industrial-strength)的有用工具。
</p>
<p>
If the source rectangle overlaps the destination rectangle on the
same pixbuf, it will be overwritten during the scaling which
results in rendering artifacts.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>src</code></em> :</span></p></td>
<td>a <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dest</code></em> :</span></p></td>
<td>这个 <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> 要渲染的目标。</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dest_x</code></em> :</span></p></td>
<td>要渲染的区域的左坐标值。</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dest_y</code></em> :</span></p></td>
<td>要渲染的区域的顶坐标值。</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dest_width</code></em> :</span></p></td>
<td>要渲染的区域的宽度。</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dest_height</code></em> :</span></p></td>
<td>要渲染的区域的高度。</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>offset_x</code></em> :</span></p></td>
<td>X 方向的偏移值(当前近似到整数)。</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>scale_x</code></em> :</span></p></td>
<td>X 坐标方向上的比例数</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>scale_y</code></em> :</span></p></td>
<td>Y 坐标方向上的比例数</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>interp_type</code></em> :</span></p></td>
<td>变形时使用的插值类型。</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-pixbuf-composite-color-simple"></a><h3>gdk_pixbuf_composite_color_simple ()</h3>
<pre class="programlisting"><a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="returnvalue">GdkPixbuf</span></a> *         gdk_pixbuf_composite_color_simple   (<em class="parameter"><code>const <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *src</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> dest_width</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> dest_height</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-pixbuf-scaling.html#GdkInterpType" title="enum GdkInterpType"><span class="type">GdkInterpType</span></a> interp_type</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> overall_alpha</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> check_size</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#guint32"><span class="type">guint32</span></a> color1</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#guint32"><span class="type">guint32</span></a> color2</code></em>);</pre>
<p>
通过缩放 <em class="parameter"><code>src</code></em> 到 <em class="parameter"><code>dest_width</code></em> x <em class="parameter"><code>dest_height</code></em> 并将结果与颜色为 <em class="parameter"><code>color1</code></em> 和 
<em class="parameter"><code>color2</code></em> 的棋盘合成来创建一个新的 <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>。
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>src</code></em> :</span></p></td>
<td>a <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dest_width</code></em> :</span></p></td>
<td>目标图像的宽度</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dest_height</code></em> :</span></p></td>
<td>目标图像的高度</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>interp_type</code></em> :</span></p></td>
<td>变形时使用的插值类型。</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>overall_alpha</code></em> :</span></p></td>
<td>原图像的整体 alpha 值(0..255)</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>check_size</code></em> :</span></p></td>
<td>棋盘(checkboard)的格子数(必须为2次方幂) <em class="parameter"><code>color1</code></em>: 左上方的格子的
颜色 <em class="parameter"><code>color2</code></em>: 其他格子的颜色。</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the new <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if not enough memory could be
allocated for it. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-pixbuf-composite"></a><h3>gdk_pixbuf_composite ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gdk_pixbuf_composite                (<em class="parameter"><code>const <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *src</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *dest</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> dest_x</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> dest_y</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> dest_width</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> dest_height</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> offset_x</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> offset_y</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> scale_x</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> scale_y</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-pixbuf-scaling.html#GdkInterpType" title="enum GdkInterpType"><span class="type">GdkInterpType</span></a> interp_type</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> overall_alpha</code></em>);</pre>
<p>
通过 <em class="parameter"><code>scale_x</code></em> 和 $scale_y 指定的缩放以及 <em class="parameter"><code>offset_x</code></em> 和 <em class="parameter"><code>offset_y</code></em> 指定的偏移量
创建一个原始图像 <em class="parameter"><code>src</code></em> 的变形图像。这给出了一个在目标 pixbuf 坐标里的一个图
像。该图像昂的一个矩形区域(<em class="parameter"><code>dest_x</code></em>, <em class="parameter"><code>dest_y</code></em>, <em class="parameter"><code>dest_width</code></em>, <em class="parameter"><code>dest_height</code></em>)会和原
始目标图像的相应矩形区域合成。
</p>
<p>
当目标矩形包含一个并不在源图像之内的一个区域时，则源图像的边缘将被无限大的复
制。
</p>
<p>
</p>
<div class="figure">
<a name="pixbuf-composite-diagram"></a><p class="title"><b>Figure 1. pixbuf 的合成
</b></p>
<div class="figure-contents"><div><img src="composite.png" alt="pixbuf 的合成"></div></div>
</div>
<p><br class="figure-break">
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>src</code></em> :</span></p></td>
<td>a <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dest</code></em> :</span></p></td>
<td>这个 <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> 要渲染的目标。</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dest_x</code></em> :</span></p></td>
<td>要渲染的区域的左坐标值。</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dest_y</code></em> :</span></p></td>
<td>要渲染的区域的顶坐标值。</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dest_width</code></em> :</span></p></td>
<td>要渲染的区域的宽度。</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dest_height</code></em> :</span></p></td>
<td>要渲染的区域的高度。</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>offset_x</code></em> :</span></p></td>
<td>X 方向的偏移值(当前近似到整数)。</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>scale_x</code></em> :</span></p></td>
<td>X 坐标方向上的比例数</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>scale_y</code></em> :</span></p></td>
<td>Y 坐标方向上的比例数</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>interp_type</code></em> :</span></p></td>
<td>变形时使用的插值类型。</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>overall_alpha</code></em> :</span></p></td>
<td>原图像的整体 alpha 值(0..255)</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-pixbuf-composite-color"></a><h3>gdk_pixbuf_composite_color ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gdk_pixbuf_composite_color          (<em class="parameter"><code>const <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *src</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *dest</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> dest_x</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> dest_y</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> dest_width</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> dest_height</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> offset_x</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> offset_y</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> scale_x</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> scale_y</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-pixbuf-scaling.html#GdkInterpType" title="enum GdkInterpType"><span class="type">GdkInterpType</span></a> interp_type</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> overall_alpha</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> check_x</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> check_y</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> check_size</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#guint32"><span class="type">guint32</span></a> color1</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#guint32"><span class="type">guint32</span></a> color2</code></em>);</pre>
<p>
通过 <em class="parameter"><code>scale_x</code></em> 和 $scale_y 指定的缩放以及 <em class="parameter"><code>offset_x</code></em> 和 <em class="parameter"><code>offset_y</code></em> 指定的偏移量
创建一个原始图像 <em class="parameter"><code>src</code></em> 的变形图像，然后将这个变型图像的一个矩形区域(<em class="parameter"><code>dest_x</code></em> ,
<em class="parameter"><code>dest_y</code></em>, <em class="parameter"><code>dest_width</code></em>, <em class="parameter"><code>dest_height</code></em>)与 <em class="parameter"><code>color1</code></em> 和 <em class="parameter"><code>color2</code></em> 组成的棋盘
(checkboard)合成，并将其渲染到目标图像。
</p>
<p>
参见 <a class="link" href="gdk-pixbuf-scaling.html#gdk-pixbuf-composite-color-simple" title="gdk_pixbuf_composite_color_simple ()"><code class="function">gdk_pixbuf_composite_color_simple()</code></a> ，一个适用于很多任务的比该函数更少参
数的函数。
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>src</code></em> :</span></p></td>
<td>a <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dest</code></em> :</span></p></td>
<td>这个 <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> 要渲染的目标。</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dest_x</code></em> :</span></p></td>
<td>要渲染的区域的左坐标值。</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dest_y</code></em> :</span></p></td>
<td>要渲染的区域的顶坐标值。</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dest_width</code></em> :</span></p></td>
<td>要渲染的区域的宽度。</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dest_height</code></em> :</span></p></td>
<td>要渲染的区域的高度。</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>offset_x</code></em> :</span></p></td>
<td>X 方向的偏移值(当前近似到整数)。</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>scale_x</code></em> :</span></p></td>
<td>X 坐标方向上的比例数</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>scale_y</code></em> :</span></p></td>
<td>Y 坐标方向上的比例数</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>interp_type</code></em> :</span></p></td>
<td>变形时使用的插值类型。</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>overall_alpha</code></em> :</span></p></td>
<td>原图像的整体 alpha 值(0..255)</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>check_x</code></em> :</span></p></td>
<td>棋盘(checkboard)的X偏移值(棋盘的起点位置在 -<em class="parameter"><code>check_x</code></em>, -<em class="parameter"><code>check_y</code></em>)。</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>check_y</code></em> :</span></p></td>
<td>棋盘(checkboard)的Y偏移值。</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>check_size</code></em> :</span></p></td>
<td>棋盘(checkboard)的格子数(必须为2次方幂) <em class="parameter"><code>color1</code></em>: 左上方的格子的
颜色 <em class="parameter"><code>color2</code></em>: 其他格子的颜色。</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="GdkPixbufRotation"></a><h3>enum GdkPixbufRotation</h3>
<pre class="programlisting">typedef enum {
	GDK_PIXBUF_ROTATE_NONE             =   0,
	GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE =  90,
	GDK_PIXBUF_ROTATE_UPSIDEDOWN       = 180,
	GDK_PIXBUF_ROTATE_CLOCKWISE        = 270
} GdkPixbufRotation;
</pre>
<p>
</p>
</div>
<hr>
<div class="refsect2">
<a name="gdk-pixbuf-rotate-simple"></a><h3>gdk_pixbuf_rotate_simple ()</h3>
<pre class="programlisting"><a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="returnvalue">GdkPixbuf</span></a> *         gdk_pixbuf_rotate_simple            (<em class="parameter"><code>const <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *src</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-pixbuf-scaling.html#GdkPixbufRotation" title="enum GdkPixbufRotation"><span class="type">GdkPixbufRotation</span></a> angle</code></em>);</pre>
<p>
旋转一个 pixbuf 90度的倍数，以一个新的 pixbuf 返回结果。
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>src</code></em> :</span></p></td>
<td>a <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>angle</code></em> :</span></p></td>
<td>旋转的角度</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the new <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if not enough memory could be
allocated for it. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.6</p>
</div>
<hr>
<div class="refsect2">
<a name="gdk-pixbuf-flip"></a><h3>gdk_pixbuf_flip ()</h3>
<pre class="programlisting"><a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="returnvalue">GdkPixbuf</span></a> *         gdk_pixbuf_flip                     (<em class="parameter"><code>const <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *src</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> horizontal</code></em>);</pre>
<p>
水平或竖直反转一个 pixbuf，以一个新的 pixbuf 返回结果。
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>src</code></em> :</span></p></td>
<td>a <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>horizontal</code></em> :</span></p></td>
<td>
<a href="../glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> 为水平反转，<a href="../glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> 竖直反转。</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the new <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if not enough memory could be
allocated for it. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.6</p>
</div>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.17</div>
</body>
</html>